<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_keyword.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Map ti_keyword = new Hashtable();
	String key = "";
	if(request.getParameter("key")!=null && !request.getParameter("key").equals("")){
		key = request.getParameter("key");
		ti_keyword.put("key_word",key);
	}
	String k_type = "";
	if(request.getParameter("k_type")!=null && !request.getParameter("k_type").equals("")){
		k_type = request.getParameter("k_type");
		ti_keyword.put("key_type",k_type);
	}
	Ti_keywordInfo ti_keywordInfo = new Ti_keywordInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_keywordInfo.getListByPage(ti_keyword,Integer.parseInt(iStart),limit);
	int counter = ti_keywordInfo.getCountByObj(ti_keyword);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?key="+key+"&k_type="+k_type+"&iStart=",Integer.parseInt(iStart),limit);
	String para =	"key="+key+"&k_type="+k_type+"&iStart="+Integer.parseInt(iStart)+"&limit="+limit;	
%>
<html>
  <head>
    <title>关键字统计</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js" charset="UtF-8"></script>
	<script language="javascript" type="text/javascript" src="/js/jquery.js"></script>
	<script type="text/javascript" src="key.js" charset="UtF-8"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>关键字统计</h1>
				<input name="searchInfo" type="button" value="查看统计" class="buttoncss" onclick="window.location.href='viewKeyChart.jsp';" />
				<input name="searchInfo" type="button" value="导出表格" class="buttoncss" onclick="check_Value()" />
				<div id="proDiv" style="display: none;"></div>
			</td>
			<td>
				<a href="addInfo.jsp"><img src="/program/admin/index/images/post.gif" border="0" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left">
				关键字:<input name="key" id="key" type="text"/>
				类型:<select name="k_type">
						<option value="">请选择</option>
						<option value="0">商品</option>
						<option value="1">卖家</option>
						<option value="2">资讯</option>
					</select>
					<input name="type" id="type" type="hidden" value="<%=k_type%>" />
				<input name="searchInfo" type="submit" value="查询" />
				
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString%></td></tr>
	</table>
	

	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter%>条
			</td>
		</tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list != null && list.size() > 0){
			listsize = list.size();
	%>	
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
		  	<th>关键字</th>
		  	<th>搜索频率</th>
		  	<th>类型</th>
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String key_id="",key_word="",location="",key_type="",key_type_="";
		  			  	if(map.get("key_id")!=null) key_id = map.get("key_id").toString();
					  	if(map.get("key_word")!=null) key_word = map.get("key_word").toString();
					  	if(map.get("location")!=null) location = map.get("location").toString();
					  	if(map.get("key_type")!=null) key_type = map.get("key_type").toString();
					  	if(key_type.equals("0"))key_type_ = "商品";
					  	if(key_type.equals("1"))key_type_ = "卖家";
					  	if(key_type.equals("2"))key_type_ = "资讯";
					  	
		%>
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i%>" id="checkone<%=i%>" value="<%=key_id %>" /></td>
		  	<td><%=key_word%></td>
		  	<td><%=location%></td>
		  	<td><%=key_type_%></td>
			<td width="10%"><a href="updateInfo.jsp?key_id=<%=key_id%>&<%=para%>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:delOneNews('<%=key_id%>');"><img src="/program/admin/images/delete.gif" title="删除" /></a></td>
		</tr>
		  <%
		  		}
		  %>
	</table>
		<%
		 }
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td align="center"><%=pageString%></td></tr>
	</table>

	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="0399" />
	  </form>
</body>

</html>
